<template>
    <input type="text" v-model="firstName" />
    <input type="text" v-model="lastName" /><br>
    完整名称：{{fullName}}
</template>

<script>
import { reactive, toRefs, computed } from 'vue'

export default {
    setup () {
        const state = reactive({
          firstName: 'hello',
          lastName: 'Vue3.0'
        })
        const fullName =computed(() => {
            return state.firstName + ' ' + state.lastName;
        })
        return {
            ...toRefs(state),
            fullName
        }
    }
}
</script>
